#pragma once
#include "Client.h"
#include "Message.h"
#include "Helper.h"
#include <vector>
using namespace std;
class GameBoardController
{
private:
	int _x;
	int _y;	
	int _height;
	int _width;	
	int _delta;
	vector<vector<int> > m_board;
	bool m_myTurn;
	bool isRivalCheck;
	bool userListChange;
	bool isWin;	
	int status;
	bool isNew;
	
	bool isLose;	
	bool isQuit;
	int size;
	bool isExit;
	
	static GameBoardController *inst;
	vector<char*> onlineUser;
public:
	bool IsExit() const { return isExit; }
	void IsExit(bool val) { isExit = val; }
	bool IsQuit() const { return isQuit; }
	void IsQuit(bool val) { isQuit = val; }
	void QuitGame();
	bool IsNew() const { return isNew; }
	void IsNew(bool val) { isNew = val; }
	int Status() const { return status; }
	void Status(int val) { status = val; }
	bool IsWin() const { return isWin; }
	void IsWin(bool val) { isWin = val; }
	bool IsLose() const { return isLose; }
	void IsLose(bool val) { isLose = val; }
	bool UserListChange() const { return userListChange; }
	void UserListChange(bool val) { userListChange = val; }
	void connectRival(char*rival);
	void getOnlineUser(char*);
	bool IsRivalCheck() const { return isRivalCheck; }
	void IsRivalCheck(bool val) { isRivalCheck = val; }
	static GameBoardController* getIntance(){
		if (NULL==inst)
		{
			inst= new GameBoardController;
		}
		return inst;
	}
	void Init();
	bool checkWin();
	bool check5(int i, int j, int dx, int dy);	
	int checkPoint(int x,int y);
	int rivalCheckPoint(int);
	vector<vector<int> > Board() const { return m_board; }
	void Board(vector<vector<int> > val) { m_board = val; }
	int Size() const { return size; }
	void Size(int val) { size = val; }
	int X() const { return _x; }
	void X(int val) { _x = val; }
	int Y() const { return _y; }
	void Y(int val) { _y = val; }
	int Height() const { return _height; }
	void Height(int val) { _height = val; }
	int Width() const { return _width; }
	int Delta() const { return _delta; }
	void Delta(int val) { _delta = val; }
	void Width(int val) { _width = val; }
	bool Turn() const { return m_myTurn; }
	void Turn(bool val) { m_myTurn = val; }
	vector<char*> OnlineUser() const { return onlineUser; }
	void OnlineUser(vector<char*> val) { onlineUser = val; }
	GameBoardController(void);
	~GameBoardController(void);
};
